package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * Created by Administrator on 2016/9/8.
 */
public class QuizVoterListAction extends AHttpService<PbBean.PbResQuestionVoterList> {

    private int quizId;
    private PbBean.PbSignBaseVoteOptionType optionType;
    private int offset = -1;

    private QuizVoterListAction(Context context, int quizId, PbBean.PbSignBaseVoteOptionType optionType, int offset) {
        super(context);
        this.quizId = quizId;
        this.optionType = optionType;
        this.offset = offset;
    }

    public static QuizVoterListAction newInstance(Context context, int quizId, PbBean.PbSignBaseVoteOptionType optionType, int offset) {
        return new QuizVoterListAction(context, quizId, optionType, offset);
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqQuestionVoterList.Builder builder = PbBean.PbReqQuestionVoterList.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setQuestionId(quizId);
        builder.setOffset(offset);
        builder.setVoteOption(optionType);
        return apiService.getQuizVoters(builder.build());
    }
}
